using System;
using System.Data;
using Utils.DatabaseUtils;
using Utils;


namespace DCSLibrary
{
public class WebLinkUI
{ 
	private int webLinkID;
	public int WebLinkID
	{
		get { return webLinkID;}
		set { webLinkID = value;}
	}

	private string companyName;
	public string CompanyName
	{
		get { return companyName;}
		set { companyName = value;}
	}

	private string webLink;
	public string WebLink
	{
		get { return webLink;}
		set { webLink = value;}
	}

	private int viewOrder;
	public int ViewOrder
	{
		get { return viewOrder;}
		set { viewOrder = value;}
	}

	public WebLinkUI() {}

	public WebLinkUI(int webLinkID, string companyName, string webLink, int viewOrder)
	 {
		this.webLinkID = webLinkID;
 		this.companyName = companyName;
 		this.webLink = webLink;
 		this.viewOrder = viewOrder;
 	}

	public int Add(string companyName, string webLink, int viewOrder)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"WebLink_Add",companyName,webLink,viewOrder);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int webLinkID, string companyName, string webLink, int viewOrder)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"WebLink_Update",webLinkID,companyName,webLink,viewOrder);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int webLinkID)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"WebLink_Delete",webLinkID);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"WebLink_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int webLinkID)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"WebLink_Get",webLinkID);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"WebLink_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
